import request from '@/utils/request'
import type { LoginParams, AuthResponse } from '@/types/auth'

// 登录
export const login = (data: LoginParams) => {
  return request.post<AuthResponse>('/auth/login', data)
}

// 获取用户信息
export const getUserInfo = () => {
  return request.get<AuthResponse>('/auth/user-info')
}

// 登出
export const logout = () => {
  return request.post('/auth/logout')
}

// 刷新token
export const refreshToken = () => {
  return request.post<AuthResponse>('/auth/refresh')
}

// 获取验证码
export const getCaptcha = () => {
  return request.get('/auth/captcha')
}
